(function($) {
	var authArr = Array();
	$.AuthButton = {
	ProcessCode : function(authCode){
		var byteC = authCode.toString(2);

		authArr = Array(byteC.length);
		var index = 0;
		// 依次打出
		while (byteC.length>0){
			authArr[index]=byteC.substr(byteC.length-1,1);
			byteC = byteC.substr(0,byteC.length-1);
			index++;
		}
		//for(var i=0;i<authArr.length;i++){
		//	console.log(authArr[i]);
		//}
	},
	AuthBtn : function(buttonAuth){
		//处理数据
		$.AuthButton.ProcessCode(buttonAuth);
  		$("button").hide();
	  	//console.log(buttonAuth);
		if (buttonAuth != 0)//权限控制
	  	{
  			if(authArr.length>0){
	 	  		if(authArr[0]*1 == 1)	//第一位=1
		  		{
		  			$("button[data-auth=1]").show();
		  		}
		  		if(authArr[1]*1 == 1)
		  		{
		  			$("button[data-auth=2]").show();
		  		} 				
  			}
	  	}else{
			//console.log('无权限控制,暂时默认显示所有');
			//无权限控制,暂时默认显示所有
	  		//$("button").show();
	  	}	
	}
	
  }
	
	$(function() {
		$.AuthButton.AuthBtn(buttonAuthCode);
		setTimeout(function(){
			$.AuthButton.AuthBtn(buttonAuthCode);
		},500);

	});
})(jQuery);
